Skip to content

Speed up String encoding on CPUs without SIMD hardware support#811

Closed
radiospiel wants to merge 1 commit into
ruby:masterfrom
radiospiel:cache-object-keys
Closed

Speed up String encoding on CPUs without SIMD hardware support#811
radiospiel wants to merge 1 commit into
ruby:masterfrom
radiospiel:cache-object-keys

Conversation

@radiospiel
Copy link
Copy Markdown
Contributor

This PR tests for the presence of characters to be escaped using SIMD with non-hardware-supported instructions. We are testing 8 chars in one round, following a code excerpt from https://lemire.me/blog/2025/04/13/detect-control-characters-quotes-and-backslashes-efficiently-using-swar/

For strings that don't require escapes I have seen speedups of around 15% with this change.

@radiospiel radiospiel changed the title Speed up String encoding for non-SSE and NEON CPUs Speed up String encoding on CPUs without SIMD hardware support May 31, 2025
@radiospiel
Copy link
Copy Markdown
Contributor Author

sry, pushed the wrong branch :(

@radiospiel radiospiel closed this May 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant